package com.xcx.portal.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xcx.common.services.DouyinService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 抖音controller
 */
@RestController
@RequestMapping(value = "/xcx/douyin")
public class DouyinController {


    @Reference
    private DouyinService douyinService;
    
    /**
     * 查询视频列表
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryVideoList", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String ListByPage(@RequestBody String reqStr) {
        return douyinService.queryVideoList(reqStr);
    }

    /**
     * 收藏
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/collectUser", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String collectUser(@RequestBody String reqStr) {
        return douyinService.collectUser(reqStr);
    }

    /**
     * 取消收藏
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/cancelCollectUser", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String cancelCollectUser(@RequestBody String reqStr) {
        return douyinService.cancelCollectUser(reqStr);
    }

    /**
     * 查询收藏列表
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryCollectList", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryCollectList(@RequestBody String reqStr) {
        return douyinService.queryCollectList(reqStr);
    }

    /**
     * 用户登录
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/userLogin", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String userLogin(@RequestBody String reqStr) {
        return douyinService.userLogin(reqStr);
    }

    /**
     * 保存用户信息
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/saveUserInfo", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String saveUserInfo(@RequestBody String reqStr) {
        return douyinService.saveUserInfo(reqStr);
    }
    
    /**
     * 查询用户是否解锁
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryUserUnlock", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryUserUnlock(@RequestBody String reqStr) {
        return douyinService.queryUserUnlock(reqStr);
    }

    /**
     * 保存更新用户分享次数
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/updateUserShare", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String updateUserShare(@RequestBody String reqStr) {
        return douyinService.updateUserShare(reqStr);
    }

}
